<?php

class Backend_Helper_Widget_Polyglot extends Backend_Helper_Widget
{

    protected $code = 'polyglot';

    public function polyglot()
    {

        $current_language = Zend_Registry::get('language');
        $languages_list   = Application_Model_Language::getList();

        if ($current_language && $current_language->getKey())
        {
            $languages_dropdown_data = array();
            foreach ($languages_list as $language)
            {
                $languages_dropdown_data[]= array(
                    'title'   => $language->getName(),
                    'key'     => $language->getKey(),
                    'current' => $language->getKey() == $current_language->getKey()
                );
            }

            return parent::render(array(
                'languages' => $languages_dropdown_data
            ));
        }
    }

}